testzarazusunefandomcom_pl-20200213-history
Moduł:VoidByReward
WARFRAME Wiki Sorted Void Drop Table By Rewards --http://warframe.wikia.com/ --Originally written by User:NoBrainz --Heavily modified by User:Falterfire <-- The person to message if something goes wrong --Pulls from Module:Void/data --Data in Void:data is structure as local tierCol = 1 -- 1 = Tier (ex "Lith") local nameCol = 2 -- 2 = Name (ex "A1 Common*") (* means vaulted) local itemCol = 3 -- 3 = Item (ex "VASTO") local partCol = 4 -- 4 = Part (ex "RECEIVER") local p = {} local VoidData = mw.loadData( 'Module:Void/data' ) local Void = require( "Module:Void" ) local Icon = require( "Module:Icon" ) local Shared = require( "Module:Shared" ) local ttStart = '' local ttEnd = '' function p.byReward(frame) local data = {} for _, relic in pairs(VoidData"Relics") do for i, drop in pairs(relic.Drops) do local newObj = {Tier = relic.Tier, Name = relic.Name, Rarity = drop.Rarity, IsVaulted = relic.IsVaulted 1, IsBaro = relic.IsBaro 1} if (datadrop.Item nil) then datadrop.Item = {} end if(datadrop.Itemdrop.Part nil) then datadrop.Itemdrop.Part = {} end table.insert(datadrop.Itemdrop.Part, newObj) end end local fullTable = {' ") return table.concat(fullTable) end --New function written by User:Falterfire --For Void Relics/ByRewards/SimpleTable function p.simpleRewardTable(frame) local data = {} --Collect data for each relic for _, relic in pairs(VoidData"Relics") do local vault = "No" if(relic.IsVaulted 1) then vault = "Yes" end --For each relic, need each drop for i, drop in pairs(relic.Drops) do --Custom objects are great local thisObj = {Item = drop.Item, Part = drop.Part, Tier = relic.Tier, Name = relic.Name, Rarity = drop.Rarity, IsVaulted = vault} table.insert(data, thisObj) end end local new function sorter(r1, r2) if(r1.Item r2.Item) then if(r1.Part r2.Part) then return r1.IsVaulted < r2.IsVaulted else return r1.Part < r2.Part end else return r1.Item < r2.Item end end table.sort(data, sorter) local rewards = {} -- Just manually sending back all table data -- Because this is easier than trying to format just rows local strTable = {' ') return table.concat(strTable) end function p.relicsTable(frame) --Function by User:Falterfire --Finds all related relics and auto-generates a table --args: -- - all unvaulted relics -- vaulted - all vaulted relics -- baro - all Baro relics --Just hardcoding in the four types --Fine as long as somebody knows how to fix this if DE introduces 5th rarity local data = {"Lith" = {}, "Meso" = {}, "Neo" = {}, "Axi" = {}} local filter = frame.args ~= nil and frame.args1 -- collect data if(filter "vaulted") then for _,relic in pairs(VoidData"Relics") do local tier = relic.Tier if(relic.IsVaulted 1) then table.insert(datatier, relic) end end elseif(filter "baro") then for _,relic in pairs(VoidData"Relics") do local tier = relic.Tier if(relic.IsBaro 1) then table.insert(datatier, relic) end end else for _,relic in pairs(VoidData"Relics") do local tier = relic.Tier if(relic.IsVaulted 0) then table.insert(datatier, relic) end end end --Setting up the table properly local tableStr = {" ') --and send it back return table.concat(tableStr) end function p.byRelic(frame) --Added by User:Falterfire --First, setting up the table columns. local tableStr = {' ") --And send it back return table.concat(tableStr) end function p.byRarity(frame) --Added by User:Falterfire --Twoooo Grakata. Or arguments. Whichever. local platform = frame.args ~= nil and frame.args1 or "PC" local checkTier = frame.args ~= nil and frame.args2 or "Lith" local data = {"Common" = {}, "Uncommon" = {}, "Rare" = {}} -- collect data for _,relic in pairs(VoidData"Relics") do local tier = relic.Tier local name = relic.Name --So first make sure this row is the right tier if(tier checkTier) then for _, drop in pairs(relic.Drops) do local rarity = drop.Rarity local item = drop.Item local part = drop.Part if(datararity"..part null) then datararity"..part = 1 end end end end --Now we can actually format the table --Starting with all the column headers local tableStr = {' ") --and send it back return table.concat(tableStr) end return p